/*

This file is part of Rooms3D.

Copyright (C) 2008 Pixecur Technologies Incorporated (Esotera).
Visit Esotera at http://www.esoteras3.com
 
Rooms3D is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
 
Rooms3D is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with Rooms3D; see the file COPYING.  If not, write to 
Pixecur Technologies, 213-31 Peet Street, St. John's, NL, A1B 3W8. 
 
Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
 
*/

package com.datasentinel.j3d.controls.hud;

import java.awt.event.ActionListener;

import javax.media.j3d.Canvas3D;

import com.datasentinel.j3d.controls.J3DButton;
import com.datasentinel.j3d.controls.J3DComponent;
import com.datasentinel.j3d.controls.J3DComponentUI;
import com.datasentinel.j3d.controls.J3DProgressBar;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class HeadsUpDisplay extends J3DComponent
{
	
	
	private HeadsUpDisplayModel model;

	private ClipboardContentsViewer clipboardContentsViewer;
	private J3DButton cancelButton;
	private J3DProgressBar progressBar;
	
	
	public HeadsUpDisplay(Canvas3D canvas3D, SimpleUniverse universe)
	{
		super(canvas3D, universe);
	}
	
	
	@Override
	protected J3DComponentUI createComponentUI()
	{
		return new HeadsUpDisplayUI();
	}
	
	@Override
	protected void initializeComponent()
	{
		this.model = new HeadsUpDisplayModel();
		this.model.addChangeListener(changeListener);
		
		clipboardContentsViewer = new ClipboardContentsViewer(canvas3D,universe);
		progressBar = new J3DProgressBar(canvas3D, universe);
		cancelButton = new J3DButton(canvas3D, universe);
		cancelButton.getModel().setText("Cancel");
		this.ui.augmentComponentGUIBranch(this);
	}
	
	
	public HeadsUpDisplayModel getModel()
	{
		return model;
	}
	
	public void setCurrentAddress(String currentAddress)
	{
		this.model.setCurrentAddress(currentAddress);
	}

	public void setCurrentFile(String currentFile)
	{
		this.model.setCurrentFile(currentFile);
	}
	
	public void setProgress(int percents)
	{
		this.progressBar.getModel().setValue(percents);
	}

	public void setShowProgress(boolean showProgress)
	{
		this.model.setShowProgress(showProgress);
	}
	
	public void addCancelButtonListener(ActionListener actionListener)
	{
		getCancelButton().addActionListener(actionListener);
	}

	public void removeCancelButtonListener(ActionListener actionListener)
	{
		getCancelButton().removeActionListener(actionListener);
	}
	
	J3DButton getCancelButton()
	{
		return cancelButton;
	}

	J3DProgressBar getProgressBar()
	{
		return progressBar;
	}

	public ClipboardContentsViewer getClipboardContentsViewer()
	{
		return clipboardContentsViewer;
	}
}
